from django.shortcuts import render_to_response, get_object_or_404
from django.http import HttpResponseRedirect, Http404
from django.template import RequestContext
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
from django.conf import settings
from django.newforms import form_for_model

from models import MentorProfile, StudentProfile, UserProfile

def render_with_request(request, template, context):
    return render_to_response(template, context, context_instance=RequestContext(request))

def index(request):
    return render_with_request('college-connect/home.html', {})

def user_profile(request, user_type):
    profile_form = form_for_model(UserProfile)
    if survey_type == "student":
        specialized_form = form_for_model(StudentProfile)
    elif survey_type == "mentor":
        specialized_form = form_for_model(MentorProfile)
    
    context = {'specialized_form': specialized_form(),
               'profile_form': profile_form(),
               'survey_type': survey_type,
               }
    return render_with_request(request, 'college-connect/profile.html', context)

def user_profile(request):
    pass 

def user_settings(request):
    pass

def connect(request):
    pass